Skip to content

feat: volume rendering axis aligned clipping planes#616

Open
seankmartin wants to merge 12 commits into
mainfrom
feature/volume-axis-aligned-clipping-planes
Open

feat: volume rendering axis aligned clipping planes#616
seankmartin wants to merge 12 commits into
mainfrom
feature/volume-axis-aligned-clipping-planes

Conversation

@seankmartin
Copy link
Copy Markdown
Collaborator

@seankmartin seankmartin commented Mar 24, 2026

Summary

Adds XYZ clipping plane support to volume rendering. Any volumes outside of these clip planes are set to be non-visible. This means that objects now can be set to be visible, and the renderer will skip rendering any non-visible object. When clipping planes are moved the proxy geometry of the volume updates to match the new bounds and the shader maps the proxy bounds to texture co-ordinates for sampling.

Clip bounds are stored on the VolumeLayer, and are used when:

  1. New chunks are available and added to volumes
  2. The clip bounds change
    to call clipToBounds on the volumes in the volume layer. To facilitate this, the previous method on the volume layer to update the transforms of the volume renderables has moved into the volume renderable. This allows the clipping function to be run independently of needing a chunk. The volume renderable also stores information about the world space bounds of the volume. This is separate to the boundingBox of the volume, because the boundingBox represents the bounding box of the proxy geometry, which may now be clipped to be smaller than the full extent of the volume.

Changes in the fragment shader are quite small, requiring two new uniforms which are used to map the existing computation that was performed in the shader into texture co-ordinates. This is because now the proxy geometry bounds may not exactly match the texture bounds.

This does not affect loading of chunks, and is purely a rendering change.

This is a video on the existing example:
https://github.com/user-attachments/assets/292ebde3-445d-47c8-9756-0c0381ab5816

This video is from an example not included in this PR, was just for testing. Can be included if desired
https://github.com/user-attachments/assets/3cd9963b-62a5-44f2-b9c5-3a37c88ee813

One note - rotations of the volume itself are not very well handled here. Rotations were already not very well handled in the previous branch. So not sure if should be considered

@seankmartin seankmartin changed the title Feature: volume rendering axis aligned clipping planes feat: volume rendering axis aligned clipping planes Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant